package com.company.Thread;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class callable {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        // new Thread(new Runnable()).start();
        // new Thread(new FutureTask<V>()).start();

        MyThread myThread = new MyThread();
        FutureTask futureTask = new FutureTask(myThread);
        new Thread(futureTask, "A").start();

        String s = (String) futureTask.get();
        System.out.println(s);
    }
}

class MyThread implements Callable<String>{
    @Override
    public String call() throws Exception {
        return "1024";
    }
}
